import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
import { ManualTimestamp } from "../decorators/manual-timestamp.decorator";

@Entity("basic_items")
@ManualTimestamp()
export class BasicItemEntity {
  @PrimaryGeneratedColumn()
  id!: number;

  @Column("varchar", { length: 100, comment: "物品名称" })
  name!: string;

  @Column("int", { name: "gold_price", comment: "金砖价格", default: 0 })
  goldPrice!: number;

  @Column("int", { name: "silver_price", comment: "银两价格", default: 0 })
  silverPrice!: number;

  @Column("int", { name: "lv", comment: "物品等级", default: 1 })
  lv!: number;

  @Column("int", { name: "weight", comment: "物品负重", default: 1 })
  weight!: number;

  @Column("varchar", {
    length: 500,
    name: "description",
    comment: "物品介绍描述",
  })
  description!: string;

  @Column("varchar", {
    length: 100,
    name: "pic",
    comment: "物品图片",
    default: "",
  })
  pic!: string;

  @Column("tinyint", {
    name: "is_treasure_shop",
    comment: "是否上架宝物商店：0-否，1-是",
    default: 0,
  })
  isTreasureShop!: number;

  @Column("tinyint", {
    name: "is_exp_shop",
    comment: "是否上架经验商店：0-否，1-是",
    default: 0,
  })
  isExpShop!: number;

  @Column("tinyint", {
    name: "status",
    comment: "物品状态：0-禁用，1-启用",
    default: 1,
  })
  status!: number;

  @Column("int", {
    name: "category",
    comment: "物品分类：1药品 2杂物 3宝石 6矿石",
    default: 2,
  })
  category!: number;

  @Column("datetime", { name: "created_at", comment: "创建时间" })
  created_at!: Date;
  @Column("datetime", {
    name: "updated_at",
    nullable: true,
    comment: "更新时间",
  })
  updated_at!: Date | null;
}
